import java.util.ArrayList;
import java.util.Scanner;


// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.

public class Practice {

    static void test1()
    {
        int count = 1;
        do {
            System.out.printf("%d ", count);
            ++count;
        } while (count <= 10);
        System.out.println();
    }
    static void test2()
    {
        // Scanner 对象类型 new Scanner 创建类型 System.in接收参数
      Scanner input=new Scanner(System.in);
      int total=0;
      int gradeCounter=0;
      while(gradeCounter<=3)
      {
          System.out.print("Enter grade: ");
          int grade=input.nextInt();
          total=total+grade;
          gradeCounter++;
      }
      System.out.printf("Average:%d%n",total/gradeCounter);
    }
    static void test3()
    {
        for(int count=0;count<=10;count++)
        {
            System.out.print(count);
        }
    }
    static void test4()
    {
        int []array=new int[10];
        int []array1={1,2,3,4,5,6,7,8,9,10};
        //array.length == 10 true
        for(int count=0;count<array1.length;count++)
        {
            System.out.printf("index: %d, value: %d",count,array1[count]);
        }
    }
    static void test5()
    {
        int[][] array1={{1,2,3},{4,5,6}};
        int[][] array2={{1,2},{3},{4,5,6}};
        System.out.println("Value in array1 by row are");
        outputArray(array1);
        System.out.printf("%nValues in array2 by row are%n");
        outputArray(array2);
    }
    public static void outputArray(int[][] array){
        for(int row=0;row<array.length;row++)
        {
            for(int column=0;column<array[row].length;column++)
            {
                System.out.printf("%d",array[row][column]);
            }
            System.out.println();
        }
    }
    public static void modifyArray(int[] array2){
        for(int counter=0;counter<array2.length;counter++)
        {
            array2[counter]*=2;

        }
    }
    static void test6()
    {
        ArrayList<Integer> a = new ArrayList<>();
        a.add(1);
        a.add(2);
        a.add(3);
        for(int aa:a)
        {
            System.out.println(aa);
        }
        if(a.contains(1))
        {
            System.out.println("find the value");
        }
        System.out.printf("print the index = 0 of the value : %d%n",a.get(0));
        System.out.println(a.indexOf(3));
        a.remove(0);
        System.out.printf("The size of the arraylist: %d%n",a.size());
        a.clear();
    }
    public static void main(String[] args) {
       //test1();
       //test2();
        //test3();
        //test6();
         String s = new String("xxx");
         System.out.printf("%s",s);
    }
}
